package edu.jmu.service.attendance.impl;

import java.util.Date;

import org.springframework.stereotype.Service;

import edu.jmu.bean.attendance.WorkTime;
import edu.jmu.service.attendance.WorkTimeService;
import edu.jmu.service.base.DaoSupport;

@Service
public abstract class WorkTimeServiceBean extends DaoSupport<WorkTime> implements WorkTimeService{
	@Override
	public WorkTime onDutyTime(Date dutytime) {
		String jpql = "select o from ManualSign o where o.signTime >= ?1 and o.signTime <= ?2";
		WorkTime workTime = (WorkTime) em.createQuery(jpql).setParameter(1, dutytime).getSingleResult();
//		super.getScrollData(0, 20, jpql, new Date[]{dutytime1,dutytime2);
		return workTime;
	}

	@Override
	public int getUserLater(int userId, Date starttime, Date endtime) {
	//	String offDutyTime = onDutyTime("offDutyTime");
		//String wherejpql = "select o from ManualSign o where o.userId = ?1 and signtime<Convert(Date,convert(varchar(10),signtime,120)+'" + offDutyTime + "') and signtag=0 and signtime between Convert(Date,'" + starttime + "') and Convert(Date,'" + endtime + "')";
	//	ManualSign manual = (ManualSign) em.createQuery(wherejpql).setParameter(1, userId).setParameter(2, starttime).setParameter(2, endtime).getSingleResult();
		return 0;
	}



}
